﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Com.CMS263.BLL;
using Com.CMS263.PO;

namespace Com.CMS263.Web.manage.TvStation
{
    public partial class Station_action : System.Web.UI.Page
    {
        Com.CMS263.BLL.TVstationBLL tvBll = new TVstationBLL();
        tvStationPeopleBLL tvpBll = new tvStationPeopleBLL();
        protected void Page_Load(object sender, EventArgs e)
        {
            string op = Request["op"];
            int id = int.Parse(Request["id"]);
            if (op=="deleteStation")
            {
                if (deleteStation(id))
                {
                    Response.Write("ok");
                }
                else
                {
                    Response.Write("no");
                }
            }
            else if (op=="deleteTvPeople")
            {
                if (deleteTvPeople(id))
                {
                    Response.Write("ok");
                }
                else
                {
                    Response.Write("no");
                }
            }
        }
        public bool deleteStation(int id)        
        {
            tvBll.tv = (Com.CMS263.PO.TVstation)tvBll.FindModelById("TVstation", id);
            if (tvBll.Delete())
            {
                return true;
            }
            else
            {
                return false;
            }
        }
        public bool deleteTvPeople(int id)
        {
            tvpBll.tvP = (TvStationPeople)tvpBll.FindModelById("TvStationPeople", id);
            if (tvpBll.Delete())
            {
                return true;
            }
            else
            {
                return false;
            }
        }
    }
}
